package com.ly.cloud.remote.feign;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.ly.cloud.remote.feign.fallback.ApprovalServiceFeignFallback;
import com.ly.cloud.web.utils.WebResponse;

/**
 * 审批流程远程调用Feign（测试）
 * 
 * @author caihuihai
 * @date 2018年12月25日 上午11:51:15
 */
@FeignClient(name = "ly-gzjw-xtsz-svc", fallback = ApprovalServiceFeignFallback.class)
public interface ApprovalServiceFeign {

	/**
	 * 审批初始化，提交业务时调用
	 * 
	 * @param ywzj
	 *            业务主键
	 * @param tableName
	 *            业务表名，从xtgl_splc_splb审批类别表中查询
	 * @return 返回的信息（0:成功,1:未定义流程,2:不启用审批流程,直接通过）
	 */
	@RequestMapping(value = "/apvl/initApproval", method = RequestMethod.POST)
	public WebResponse<String> initApproval(@RequestParam(value = "ywzj") String ywzj,
			@RequestParam(value = "tableName") String tableName);

	/**
	 * 审批处理过程，<br/>
	 * 在获取返回值的时候后需在代码中判断此值是否为null,如何不为null则要更新审批状态为此返回值.
	 * 
	 * @param ywzj
	 *            业务主键
	 * @param tableName
	 *            对应的业务表名，例如LY_CKBZ_GXJW_KCSJSQL
	 * @param sprbh
	 *            审批人工号
	 * @param spyj
	 *            审批意见
	 * @param spzt
	 *            审批状态(1:通过 , 0:不通过)
	 * @return 返回的审批状态信息（8:审批不通过,9审批通过）
	 */
	@RequestMapping(value = "/apvl/processApproval", method = RequestMethod.POST)
	public WebResponse<String> processApproval(@RequestParam(value = "ywzj") String ywzj,
			@RequestParam(value = "tableName") String tableName, @RequestParam(value = "sprbh") String sprbh,
			@RequestParam(value = "spyj", required = false) String spyj, @RequestParam(value = "spzt") String spzt);
	
	
	@RequestMapping(value = "/apvl/genRuleCode", method = RequestMethod.GET)
	public WebResponse<String> genRuleCode(@RequestParam(value="bbh") String bbh);
	
	
}
